package com.study.annotation;

import org.springframework.core.io.Resource;
import org.springframework.core.type.AnnotationMetadata;
import org.springframework.core.type.ClassMetadata;
import org.springframework.core.type.classreading.MetadataReader;
import org.springframework.core.type.classreading.MetadataReaderFactory;
import org.springframework.core.type.filter.TypeFilter;

import java.io.IOException;

public class MyTypeFilter implements TypeFilter {
    public boolean match(MetadataReader metadataReader, MetadataReaderFactory metadataReaderFactory) throws IOException {

        AnnotationMetadata annotationMetadata = metadataReader.getAnnotationMetadata();
        ClassMetadata classMetadata = metadataReader.getClassMetadata();
        Resource resource = metadataReader.getResource();
        System.out.println("annotationMetadata" + "--------------->" + annotationMetadata);
        System.out.println("classMetadata" + "--------------->" + classMetadata);
        System.out.println("resource" + "--------------->" + resource);
        System.out.println(classMetadata.getClassName());
        System.out.println(Dog.class.getName());
        if (classMetadata.getClassName().equals(Dog.class.getName())){
            return true;
        }

        return false;
    }
}
